package com.runa.rccprotocol.dto.runa;

import com.runa.protocol.dto.DtuReportAck;
import com.runa.protocol.util.ByteUtil;
import com.runa.rccprotocol.constant.AppFunCode;

/**
 * @author zhuj
 */
public class RunaFmuDataAck extends DtuReportAck {

    public RunaFmuDataAck(RunaFrameSequence.Area area, int pseq) {
        RunaICStruct struct = new RunaICStruct();
        //DIR:0,下行数据;PRM:0,从动站;FCV:0;FCB_ACD:0
        struct.setControl(new RunaFrameSequence.Control(0, 0, 0, 0, AppFunCode.prmFunCode.PRM0_Affirm));
        struct.setArea(area);
        struct.setAfn(AppFunCode.rnicAFN.AffirmDeny);
        //TpV:0,无时间标签;FIR:1&FIN:1,单帧;CON:0,无需回复;PSEQ_RSEQ:0,
        struct.setSeq(new RunaFrameSequence.Seq(0, 1, 1, 0, pseq));
        struct.addDataField(new RunaFrameSequence.DataUnit(0, 1, null));

        data = struct.getBuffer();
        String s = ByteUtil.byteToHexString(data, 0, data.length);
        System.out.println(s);
    }

}
